package cn.zf233.xcloud.commom.enums;

/**
 * Created by zf233 on 2020/1/30
 * 用户角色
 */
public enum UserRoleENUM {

    USER("USER", 0),
    ADMIN("ADMIN", 1);

    private final String describe;
    private final Integer code;

    public static Boolean exists(Integer type) {
        for (UserRoleENUM value : values()) {
            if (value.getCode().equals(type)) {
                return true;
            }
        }
        return false;
    }

    public static String getUserRoleName(Integer type) {
        for (UserRoleENUM value : values()) {
            if (value.getCode().equals(type)) {
                return value.getDescribe();
            }
        }
        return "未知";
    }

    UserRoleENUM(String describe, Integer code) {
        this.describe = describe;
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescribe() {
        return describe;
    }
}